package creational.singleton;

/**
 * @desc 懒汉模式 线程安全 没有效率
 */
public class Singleton3 {
    private static volatile Singleton3 singleton = null;

    private Singleton3() {
    }

    public static Singleton3 getSingleton() {
        synchronized (Singleton3.class) {
            if (singleton == null) {
                singleton = new Singleton3();
            }
        }
        return singleton;
    }
}

